class Money implements Cloneable{
    public int m = 99;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Student implements Cloneable{
    Money money = new Money();
    public int age;
    public String name;
    Student(){

    }
    Student(int age,String name){
        this.age = age;
        this.name = name;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Student t = (Student) super.clone();
        t.money = (Money) this.money.clone();
        return t;

        //return super.clone();
    }

    @Override
    public String toString() {
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                '}';
    }
}

public class Haha {
    public static void main(String[] args) throws CloneNotSupportedException {
        Student student1 = new Student(11,"wang");
        Student student2 = (Student) student1.clone();
        System.out.println(student1.toString());
        System.out.println(student2.toString());
        System.out.println("==================");
        System.out.println(student1.money.m);
        System.out.println(student2.money.m);
        System.out.println("=========");
        student1.money.m = 19;
        System.out.println(student2.money.m);
        System.out.println(student1.money.m);


    }
}
